package com.sh.weblogspringboot.admin.controller;

import com.sh.weblogspringboot.admin.service.AdminTagService;
import com.sh.weblogspringboot.admin.vo.tag.AddTagReqVO;
import com.sh.weblogspringboot.admin.vo.tag.DeleteTagReqVO;
import com.sh.weblogspringboot.admin.vo.tag.FindTagPageListReqVO;
import com.sh.weblogspringboot.admin.vo.tag.SearchTagReqVO;
import com.sh.weblogspringboot.common.aspect.ApiOperationLog;
import com.sh.weblogspringboot.common.util.Response;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author songHai
 * @Classname AdminTagController
 * @Description Admin 标签 Controller
 * @Date 2025/3/31 19:50
 */
@RestController
@RequestMapping("/admin/tag")
@Api(tags = "Admin 标签")
public class AdminTagController {

    @Autowired
    private AdminTagService adminTagService;

    @RequestMapping("/add")
    @ApiOperationLog(description = "添加标签")
    @ApiOperation(value = "添加标签")
    public Response addTagInfo(@RequestBody @Validated AddTagReqVO addTagReqVO) {
        return adminTagService.addTag(addTagReqVO);
    }


    @PostMapping("/list")
    @ApiOperationLog(description = "标签分页查询")
    @ApiOperation(value = "标签分页查询")
    public Response findTagPageList(@RequestBody @Validated FindTagPageListReqVO findTagPageListReqVO) {
        return adminTagService.findTagPageList(findTagPageListReqVO);
    }

    @PostMapping("/delete")
    @ApiOperationLog(description = "根据ID删除标签")
    @ApiOperation(value = "根据ID删除标签")
    public Response deleteTagById(@RequestBody @Validated DeleteTagReqVO deleteTagReqVO) {
        return adminTagService.deleteTagById(deleteTagReqVO);
    }

    @PostMapping("/search")
    @ApiOperationLog(description = "标签模糊查询")
    @ApiOperation(value = "标签模糊查询")
    public Response searchTag(@RequestBody @Validated SearchTagReqVO searchTagReqVO) {
        return adminTagService.searchTag(searchTagReqVO);
    }

    @PostMapping("/select/list")
    @ApiOperationLog(description = "查询标签Select列表数据")
    @ApiOperation(value = "查询标签Select列表数据")
    public Response findTagSelectList() {
        return adminTagService.findTagSelectList();
    }

}
